<?php

namespace app\applet\controller;

use app\BaseController;
use think\facade\Db;

class Maintenance extends BaseController
{
    public function index(){

    }

    public function  add(){
        $data=request()->post();
        $add["room_id"]=$data["room"]["id"];
        $add["address"]=$data["room"]["address"];
        $add["community_id"]=$data["room"]["community_id"];
        $add["community_name"]=$data["room"]["community_name"];
        $add["create_time"]=date("Y-m-d H:i:s");
        $add["openid"]=$this->request->openid;
        $add["type"]=$data["type"];
        $add["content"]=$data["content"];
        $add["person_id"]=$data["contact"];
        $add["type"]=$data["type"];
        $add["imgs"]=[];
        foreach ($data["imgs"] as $value){
           array_push($add["imgs"],$value["src"]);
        }
        $add["imgs"]=implode(",",$add["imgs"]);
        Db::table("wxpro_maintenance")->insert($add);
        parent::sendOutput($add);
    }
}